﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.Distribution.Dto
@model IPagedList<DistributionViewDto>
@{
    Layout = null;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {
            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
    var sumLoadCarCount = 0;
    var sumRestaurantInfoCount = 0;
}
<div id="table_print" style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>装车单号</th>
                <th>配送状态</th>
                <th>装车时间</th>
                <th>配送司机</th>
                <th>车牌号</th>
                <th>装车总数</th>

                <th>已配送餐厅</th>

                @*<th style="width:200px;">操作</th>*@
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td class="text-center" colspan="8">暂无配送信息</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    sumLoadCarCount += item.Countproduct;
                    sumRestaurantInfoCount += item.RestaurantInfoCount;
                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.CreationNumber</td>
                        <td>@item.CarStatus</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                        <td>@item.Name</td>
                        <td>@item.PlatesNumber</td>
                        <td>@item.Countproduct</td>
                        <td>@item.RestaurantInfoCount</td>
                    </tr>
                }
                <tr class="footer">
                    <td style="color:red;">合计</td>
                    <td colspan="5"></td>
                    <td style="color:red;">@sumLoadCarCount</td>
                    <td style="color:red;">@sumRestaurantInfoCount</td>
                </tr>
            }
        </tbody>
    </table>

</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条，@Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        @Html.PagedListPager(Model, page => Url.Action("DistributionIndex", new { pageIdx = page , size = Context.Request.Query["size"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>
